#pragma once
#include <QTcpServer>
#include "FileTransferDef.h"

class FileReceiverServer : public QTcpServer
{
    Q_OBJECT
public:
    explicit FileReceiverServer(QObject* parent = nullptr);
    ~FileReceiverServer();

public:
    void setSavePaths(const QList<FileTransferDef::sRevSavePath>& revSavePaths);

protected:
    void incomingConnection(qintptr socketDescriptor) override;

signals:
    void signalReceiveProgressChanged(const QString& ip, int percentage);
    void signalFileReceiveFinished(const QString& ip, const QString& filePath, const QByteArray& userData);
    void signalReceiveStart(const QString& ip);
    void signalReceiveError(const QString& ip, FileTransferDef::eRecevieError);

private:
    QList<FileTransferDef::sRevSavePath> mSavePaths;
};